objectFileName = "/data1/team/weijiang/workspace/polyIRToolkit/polyIRIndexer/06.topics.801-850.polyIRTKCompatibleMode"
f = open(objectFileName,"r")

queriesInPart1 = []
queriesInPart2 = []
queriesBothParts = []

for line in f.readlines():
    queryNumber = line.strip().split(":")[0]
    queryContent = line.strip().split(":")[1]
    queryContentElements = line.strip().split(":")[1].split(" ")
    #print "queryContentElements:",queryContentElements
    inPart1FlagOnly = True
    inPart2FlagOnly = True
    inBothPartsFlag = True
    for element in queryContentElements:
        if element.lower() > "snuff":
            inPart1FlagOnly = False
        if element.lower() < "snyder":
            inPart2FlagOnly = False
    
    if(inPart1FlagOnly):
        queriesInPart1.append(queryContent)
    elif(inPart2FlagOnly):
        queriesInPart2.append(queryContent)
    else:
        queriesBothParts.append(queryContent)
        

print "Year 2006 Gov2 human judged queries:"
     
print "len(queriesInPart1):",len(queriesInPart1)
queriesInPart1.sort(cmp=None, key=None, reverse=False)
for queryInPart1 in queriesInPart1:
    print queryInPart1

print "len(queriesInPart2):",len(queriesInPart2)
queriesInPart2.sort(cmp=None, key=None, reverse=False)
for queryInPart2 in queriesInPart2:
    print queryInPart2

print "len(queriesBothParts):",len(queriesBothParts)
queriesBothParts.sort(cmp=None, key=None, reverse=False)
#for queryInBothParts in queriesBothParts:
#    print queryInBothParts

#part1 end
#snowtel
#snowy
#snr
#sns
#snuff

#part2 begin
#snyder
#so
#soalr
#soap
#soaps
